
_DS1307_Init:

;DS1307.c,22 :: 		void DS1307_Init(){
;DS1307.c,24 :: 		I2C1_Init(100000);
	MOVLW      20
	MOVWF      SSPADD+0
	CALL       _I2C1_Init+0
;DS1307.c,25 :: 		I2C1_Start();
	CALL       _I2C1_Start+0
;DS1307.c,26 :: 		I2C1_Wr( 0xD0);           // Slave address of DS1307
	MOVLW      208
	MOVWF      FARG_I2C1_Wr_data_+0
	CALL       _I2C1_Wr+0
;DS1307.c,27 :: 		I2C1_Wr( 0x00);           // Start from word at Address REG0
	CLRF       FARG_I2C1_Wr_data_+0
	CALL       _I2C1_Wr+0
;DS1307.c,29 :: 		I2C1_Stop();
	CALL       _I2C1_Stop+0
;DS1307.c,30 :: 		}
L_end_DS1307_Init:
	RETURN
; end of _DS1307_Init

_DS1307_BCD2Dec:

;DS1307.c,31 :: 		unsigned short DS1307_BCD2Dec(unsigned short n){
;DS1307.c,32 :: 		return(((( n & 0x70)>>4) * 10)+ (n & 0x0F));
	MOVLW      112
	ANDWF      FARG_DS1307_BCD2Dec_n+0, 0
	MOVWF      R2+0
	MOVF       R2+0, 0
	MOVWF      R0+0
	RRF        R0+0, 1
	BCF        R0+0, 7
	RRF        R0+0, 1
	BCF        R0+0, 7
	RRF        R0+0, 1
	BCF        R0+0, 7
	RRF        R0+0, 1
	BCF        R0+0, 7
	MOVLW      10
	MOVWF      R4+0
	CALL       _Mul_8x8_U+0
	MOVLW      15
	ANDWF      FARG_DS1307_BCD2Dec_n+0, 0
	MOVWF      R1+0
	MOVF       R1+0, 0
	ADDWF      R0+0, 1
;DS1307.c,33 :: 		}
L_end_DS1307_BCD2Dec:
	RETURN
; end of _DS1307_BCD2Dec

_DS1307_Dec2BCD:

;DS1307.c,34 :: 		unsigned short DS1307_Dec2BCD(unsigned short n){
;DS1307.c,36 :: 		return (((n/10)<<4)+(n%10));
	MOVLW      10
	MOVWF      R4+0
	MOVF       FARG_DS1307_Dec2BCD_n+0, 0
	MOVWF      R0+0
	CALL       _Div_8x8_U+0
	MOVF       R0+0, 0
	MOVWF      FLOC__DS1307_Dec2BCD+0
	RLF        FLOC__DS1307_Dec2BCD+0, 1
	BCF        FLOC__DS1307_Dec2BCD+0, 0
	RLF        FLOC__DS1307_Dec2BCD+0, 1
	BCF        FLOC__DS1307_Dec2BCD+0, 0
	RLF        FLOC__DS1307_Dec2BCD+0, 1
	BCF        FLOC__DS1307_Dec2BCD+0, 0
	RLF        FLOC__DS1307_Dec2BCD+0, 1
	BCF        FLOC__DS1307_Dec2BCD+0, 0
	MOVLW      10
	MOVWF      R4+0
	MOVF       FARG_DS1307_Dec2BCD_n+0, 0
	MOVWF      R0+0
	CALL       _Div_8x8_U+0
	MOVF       R8+0, 0
	MOVWF      R0+0
	MOVF       FLOC__DS1307_Dec2BCD+0, 0
	ADDWF      R0+0, 1
;DS1307.c,38 :: 		}
L_end_DS1307_Dec2BCD:
	RETURN
; end of _DS1307_Dec2BCD

_DS1307_GetDateTime:

;DS1307.c,40 :: 		void DS1307_GetDateTime(RTC_Time *p)
;DS1307.c,42 :: 		I2C1_Start();
	CALL       _I2C1_Start+0
;DS1307.c,43 :: 		I2C1_Wr(0xD0);
	MOVLW      208
	MOVWF      FARG_I2C1_Wr_data_+0
	CALL       _I2C1_Wr+0
;DS1307.c,44 :: 		I2C1_Wr(0x00);
	CLRF       FARG_I2C1_Wr_data_+0
	CALL       _I2C1_Wr+0
;DS1307.c,45 :: 		I2C1_Repeated_Start();
	CALL       _I2C1_Repeated_Start+0
;DS1307.c,46 :: 		I2C1_Wr(0xD1);
	MOVLW      209
	MOVWF      FARG_I2C1_Wr_data_+0
	CALL       _I2C1_Wr+0
;DS1307.c,48 :: 		p->sec      = DS1307_BCD2Dec(I2C1_Rd(1));
	MOVF       FARG_DS1307_GetDateTime_p+0, 0
	MOVWF      FLOC__DS1307_GetDateTime+0
	MOVLW      1
	MOVWF      FARG_I2C1_Rd_ack+0
	CALL       _I2C1_Rd+0
	MOVF       R0+0, 0
	MOVWF      FARG_DS1307_BCD2Dec_n+0
	CALL       _DS1307_BCD2Dec+0
	MOVF       FLOC__DS1307_GetDateTime+0, 0
	MOVWF      FSR
	MOVF       R0+0, 0
	MOVWF      INDF+0
;DS1307.c,49 :: 		p->min      = DS1307_BCD2Dec(I2C1_Rd(1));
	INCF       FARG_DS1307_GetDateTime_p+0, 0
	MOVWF      FLOC__DS1307_GetDateTime+0
	MOVLW      1
	MOVWF      FARG_I2C1_Rd_ack+0
	CALL       _I2C1_Rd+0
	MOVF       R0+0, 0
	MOVWF      FARG_DS1307_BCD2Dec_n+0
	CALL       _DS1307_BCD2Dec+0
	MOVF       FLOC__DS1307_GetDateTime+0, 0
	MOVWF      FSR
	MOVF       R0+0, 0
	MOVWF      INDF+0
;DS1307.c,50 :: 		p->hour     = DS1307_BCD2Dec(I2C1_Rd(1));
	MOVLW      4
	ADDWF      FARG_DS1307_GetDateTime_p+0, 0
	MOVWF      FLOC__DS1307_GetDateTime+0
	MOVLW      1
	MOVWF      FARG_I2C1_Rd_ack+0
	CALL       _I2C1_Rd+0
	MOVF       R0+0, 0
	MOVWF      FARG_DS1307_BCD2Dec_n+0
	CALL       _DS1307_BCD2Dec+0
	MOVF       FLOC__DS1307_GetDateTime+0, 0
	MOVWF      FSR
	MOVF       R0+0, 0
	MOVWF      INDF+0
;DS1307.c,51 :: 		p->week_day = DS1307_BCD2Dec(I2C1_Rd(1));
	MOVLW      2
	ADDWF      FARG_DS1307_GetDateTime_p+0, 0
	MOVWF      FLOC__DS1307_GetDateTime+0
	MOVLW      1
	MOVWF      FARG_I2C1_Rd_ack+0
	CALL       _I2C1_Rd+0
	MOVF       R0+0, 0
	MOVWF      FARG_DS1307_BCD2Dec_n+0
	CALL       _DS1307_BCD2Dec+0
	MOVF       FLOC__DS1307_GetDateTime+0, 0
	MOVWF      FSR
	MOVF       R0+0, 0
	MOVWF      INDF+0
;DS1307.c,52 :: 		p->day      = DS1307_BCD2Dec(I2C1_Rd(1));
	MOVLW      3
	ADDWF      FARG_DS1307_GetDateTime_p+0, 0
	MOVWF      FLOC__DS1307_GetDateTime+0
	MOVLW      1
	MOVWF      FARG_I2C1_Rd_ack+0
	CALL       _I2C1_Rd+0
	MOVF       R0+0, 0
	MOVWF      FARG_DS1307_BCD2Dec_n+0
	CALL       _DS1307_BCD2Dec+0
	MOVF       FLOC__DS1307_GetDateTime+0, 0
	MOVWF      FSR
	MOVF       R0+0, 0
	MOVWF      INDF+0
;DS1307.c,53 :: 		p->month    = DS1307_BCD2Dec(I2C1_Rd(1));
	MOVLW      5
	ADDWF      FARG_DS1307_GetDateTime_p+0, 0
	MOVWF      FLOC__DS1307_GetDateTime+0
	MOVLW      1
	MOVWF      FARG_I2C1_Rd_ack+0
	CALL       _I2C1_Rd+0
	MOVF       R0+0, 0
	MOVWF      FARG_DS1307_BCD2Dec_n+0
	CALL       _DS1307_BCD2Dec+0
	MOVF       FLOC__DS1307_GetDateTime+0, 0
	MOVWF      FSR
	MOVF       R0+0, 0
	MOVWF      INDF+0
;DS1307.c,54 :: 		p->year     = DS1307_BCD2Dec(I2C1_Rd(1));
	MOVLW      6
	ADDWF      FARG_DS1307_GetDateTime_p+0, 0
	MOVWF      FLOC__DS1307_GetDateTime+0
	MOVLW      1
	MOVWF      FARG_I2C1_Rd_ack+0
	CALL       _I2C1_Rd+0
	MOVF       R0+0, 0
	MOVWF      FARG_DS1307_BCD2Dec_n+0
	CALL       _DS1307_BCD2Dec+0
	MOVF       FLOC__DS1307_GetDateTime+0, 0
	MOVWF      FSR
	MOVF       R0+0, 0
	MOVWF      INDF+0
;DS1307.c,55 :: 		I2C1_Stop() ;
	CALL       _I2C1_Stop+0
;DS1307.c,57 :: 		}
L_end_DS1307_GetDateTime:
	RETURN
; end of _DS1307_GetDateTime

_DS1307_SetDateTime:

;DS1307.c,59 :: 		void DS1307_SetDateTime(RTC_Time *p)
;DS1307.c,62 :: 		I2C1_Start();
	CALL       _I2C1_Start+0
;DS1307.c,63 :: 		I2C1_Wr(0xD0);
	MOVLW      208
	MOVWF      FARG_I2C1_Wr_data_+0
	CALL       _I2C1_Wr+0
;DS1307.c,64 :: 		I2C1_Wr(0x00);
	CLRF       FARG_I2C1_Wr_data_+0
	CALL       _I2C1_Wr+0
;DS1307.c,65 :: 		I2C1_Wr(DS1307_Dec2BCD(p->sec));             //REGO
	MOVF       FARG_DS1307_SetDateTime_p+0, 0
	MOVWF      FSR
	MOVF       INDF+0, 0
	MOVWF      FARG_DS1307_Dec2BCD_n+0
	CALL       _DS1307_Dec2BCD+0
	MOVF       R0+0, 0
	MOVWF      FARG_I2C1_Wr_data_+0
	CALL       _I2C1_Wr+0
;DS1307.c,66 :: 		I2C1_Wr(DS1307_Dec2BCD(p->min));             //REG1
	INCF       FARG_DS1307_SetDateTime_p+0, 0
	MOVWF      FSR
	MOVF       INDF+0, 0
	MOVWF      FARG_DS1307_Dec2BCD_n+0
	CALL       _DS1307_Dec2BCD+0
	MOVF       R0+0, 0
	MOVWF      FARG_I2C1_Wr_data_+0
	CALL       _I2C1_Wr+0
;DS1307.c,67 :: 		I2C1_Wr(DS1307_Dec2BCD(p->hour));            //REG2
	MOVLW      4
	ADDWF      FARG_DS1307_SetDateTime_p+0, 0
	MOVWF      FSR
	MOVF       INDF+0, 0
	MOVWF      FARG_DS1307_Dec2BCD_n+0
	CALL       _DS1307_Dec2BCD+0
	MOVF       R0+0, 0
	MOVWF      FARG_I2C1_Wr_data_+0
	CALL       _I2C1_Wr+0
;DS1307.c,68 :: 		I2C1_Wr(DS1307_Dec2BCD(p->week_day));        //REG3
	MOVLW      2
	ADDWF      FARG_DS1307_SetDateTime_p+0, 0
	MOVWF      FSR
	MOVF       INDF+0, 0
	MOVWF      FARG_DS1307_Dec2BCD_n+0
	CALL       _DS1307_Dec2BCD+0
	MOVF       R0+0, 0
	MOVWF      FARG_I2C1_Wr_data_+0
	CALL       _I2C1_Wr+0
;DS1307.c,69 :: 		I2C1_Wr(DS1307_Dec2BCD(p->day));             //REG4
	MOVLW      3
	ADDWF      FARG_DS1307_SetDateTime_p+0, 0
	MOVWF      FSR
	MOVF       INDF+0, 0
	MOVWF      FARG_DS1307_Dec2BCD_n+0
	CALL       _DS1307_Dec2BCD+0
	MOVF       R0+0, 0
	MOVWF      FARG_I2C1_Wr_data_+0
	CALL       _I2C1_Wr+0
;DS1307.c,70 :: 		I2C1_Wr(DS1307_Dec2BCD(p->month));           //REG5
	MOVLW      5
	ADDWF      FARG_DS1307_SetDateTime_p+0, 0
	MOVWF      FSR
	MOVF       INDF+0, 0
	MOVWF      FARG_DS1307_Dec2BCD_n+0
	CALL       _DS1307_Dec2BCD+0
	MOVF       R0+0, 0
	MOVWF      FARG_I2C1_Wr_data_+0
	CALL       _I2C1_Wr+0
;DS1307.c,71 :: 		I2C1_Wr(DS1307_Dec2BCD(p->year));            //REG6
	MOVLW      6
	ADDWF      FARG_DS1307_SetDateTime_p+0, 0
	MOVWF      FSR
	MOVF       INDF+0, 0
	MOVWF      FARG_DS1307_Dec2BCD_n+0
	CALL       _DS1307_Dec2BCD+0
	MOVF       R0+0, 0
	MOVWF      FARG_I2C1_Wr_data_+0
	CALL       _I2C1_Wr+0
;DS1307.c,72 :: 		I2C1_Wr(0x80);
	MOVLW      128
	MOVWF      FARG_I2C1_Wr_data_+0
	CALL       _I2C1_Wr+0
;DS1307.c,73 :: 		I2C1_Stop();
	CALL       _I2C1_Stop+0
;DS1307.c,75 :: 		}
L_end_DS1307_SetDateTime:
	RETURN
; end of _DS1307_SetDateTime

_DS1307_LCD_Display_Time:

;DS1307.c,77 :: 		void DS1307_LCD_Display_Time(RTC_Time *p)
;DS1307.c,80 :: 		Lcd_Chr(1, 6, (p->day / 10)   + 48);    // Print tens digit of day variable
	MOVLW      1
	MOVWF      FARG_Lcd_Chr_row+0
	MOVLW      6
	MOVWF      FARG_Lcd_Chr_column+0
	MOVLW      3
	ADDWF      FARG_DS1307_LCD_Display_Time_p+0, 0
	MOVWF      FSR
	MOVF       INDF+0, 0
	MOVWF      R0+0
	MOVLW      10
	MOVWF      R4+0
	CALL       _Div_8x8_U+0
	MOVLW      48
	ADDWF      R0+0, 0
	MOVWF      FARG_Lcd_Chr_out_char+0
	CALL       _Lcd_Chr+0
;DS1307.c,81 :: 		Lcd_Chr(1, 7, (p->day % 10)   + 48);    // Print oness digit of day variable
	MOVLW      1
	MOVWF      FARG_Lcd_Chr_row+0
	MOVLW      7
	MOVWF      FARG_Lcd_Chr_column+0
	MOVLW      3
	ADDWF      FARG_DS1307_LCD_Display_Time_p+0, 0
	MOVWF      FSR
	MOVF       INDF+0, 0
	MOVWF      R0+0
	MOVLW      10
	MOVWF      R4+0
	CALL       _Div_8x8_U+0
	MOVF       R8+0, 0
	MOVWF      R0+0
	MOVLW      48
	ADDWF      R0+0, 0
	MOVWF      FARG_Lcd_Chr_out_char+0
	CALL       _Lcd_Chr+0
;DS1307.c,82 :: 		Lcd_Chr(1, 9, (p->month / 10) + 48);
	MOVLW      1
	MOVWF      FARG_Lcd_Chr_row+0
	MOVLW      9
	MOVWF      FARG_Lcd_Chr_column+0
	MOVLW      5
	ADDWF      FARG_DS1307_LCD_Display_Time_p+0, 0
	MOVWF      FSR
	MOVF       INDF+0, 0
	MOVWF      R0+0
	MOVLW      10
	MOVWF      R4+0
	CALL       _Div_8x8_U+0
	MOVLW      48
	ADDWF      R0+0, 0
	MOVWF      FARG_Lcd_Chr_out_char+0
	CALL       _Lcd_Chr+0
;DS1307.c,83 :: 		Lcd_Chr(1,10, (p->month % 10) + 48);
	MOVLW      1
	MOVWF      FARG_Lcd_Chr_row+0
	MOVLW      10
	MOVWF      FARG_Lcd_Chr_column+0
	MOVLW      5
	ADDWF      FARG_DS1307_LCD_Display_Time_p+0, 0
	MOVWF      FSR
	MOVF       INDF+0, 0
	MOVWF      R0+0
	MOVLW      10
	MOVWF      R4+0
	CALL       _Div_8x8_U+0
	MOVF       R8+0, 0
	MOVWF      R0+0
	MOVLW      48
	ADDWF      R0+0, 0
	MOVWF      FARG_Lcd_Chr_out_char+0
	CALL       _Lcd_Chr+0
;DS1307.c,84 :: 		Lcd_Chr(1,14, (p->year / 10)   + 48);    // Print year variable  (start from year 2010)
	MOVLW      1
	MOVWF      FARG_Lcd_Chr_row+0
	MOVLW      14
	MOVWF      FARG_Lcd_Chr_column+0
	MOVLW      6
	ADDWF      FARG_DS1307_LCD_Display_Time_p+0, 0
	MOVWF      FSR
	MOVF       INDF+0, 0
	MOVWF      R0+0
	MOVLW      10
	MOVWF      R4+0
	CALL       _Div_8x8_U+0
	MOVLW      48
	ADDWF      R0+0, 0
	MOVWF      FARG_Lcd_Chr_out_char+0
	CALL       _Lcd_Chr+0
;DS1307.c,85 :: 		Lcd_Chr(1,15, (p->year %10)   + 48);
	MOVLW      1
	MOVWF      FARG_Lcd_Chr_row+0
	MOVLW      15
	MOVWF      FARG_Lcd_Chr_column+0
	MOVLW      6
	ADDWF      FARG_DS1307_LCD_Display_Time_p+0, 0
	MOVWF      FSR
	MOVF       INDF+0, 0
	MOVWF      R0+0
	MOVLW      10
	MOVWF      R4+0
	CALL       _Div_8x8_U+0
	MOVF       R8+0, 0
	MOVWF      R0+0
	MOVLW      48
	ADDWF      R0+0, 0
	MOVWF      FARG_Lcd_Chr_out_char+0
	CALL       _Lcd_Chr+0
;DS1307.c,88 :: 		Lcd_Chr(2, 6, (p->hour / 10)   + 48);
	MOVLW      2
	MOVWF      FARG_Lcd_Chr_row+0
	MOVLW      6
	MOVWF      FARG_Lcd_Chr_column+0
	MOVLW      4
	ADDWF      FARG_DS1307_LCD_Display_Time_p+0, 0
	MOVWF      FSR
	MOVF       INDF+0, 0
	MOVWF      R0+0
	MOVLW      10
	MOVWF      R4+0
	CALL       _Div_8x8_U+0
	MOVLW      48
	ADDWF      R0+0, 0
	MOVWF      FARG_Lcd_Chr_out_char+0
	CALL       _Lcd_Chr+0
;DS1307.c,89 :: 		Lcd_Chr(2, 7, (p->hour % 10)   + 48);
	MOVLW      2
	MOVWF      FARG_Lcd_Chr_row+0
	MOVLW      7
	MOVWF      FARG_Lcd_Chr_column+0
	MOVLW      4
	ADDWF      FARG_DS1307_LCD_Display_Time_p+0, 0
	MOVWF      FSR
	MOVF       INDF+0, 0
	MOVWF      R0+0
	MOVLW      10
	MOVWF      R4+0
	CALL       _Div_8x8_U+0
	MOVF       R8+0, 0
	MOVWF      R0+0
	MOVLW      48
	ADDWF      R0+0, 0
	MOVWF      FARG_Lcd_Chr_out_char+0
	CALL       _Lcd_Chr+0
;DS1307.c,90 :: 		Lcd_Chr(2, 9, (p->min / 10) + 48);
	MOVLW      2
	MOVWF      FARG_Lcd_Chr_row+0
	MOVLW      9
	MOVWF      FARG_Lcd_Chr_column+0
	INCF       FARG_DS1307_LCD_Display_Time_p+0, 0
	MOVWF      FSR
	MOVF       INDF+0, 0
	MOVWF      R0+0
	MOVLW      10
	MOVWF      R4+0
	CALL       _Div_8x8_U+0
	MOVLW      48
	ADDWF      R0+0, 0
	MOVWF      FARG_Lcd_Chr_out_char+0
	CALL       _Lcd_Chr+0
;DS1307.c,91 :: 		Lcd_Chr(2,10, (p->min % 10) + 48);
	MOVLW      2
	MOVWF      FARG_Lcd_Chr_row+0
	MOVLW      10
	MOVWF      FARG_Lcd_Chr_column+0
	INCF       FARG_DS1307_LCD_Display_Time_p+0, 0
	MOVWF      FSR
	MOVF       INDF+0, 0
	MOVWF      R0+0
	MOVLW      10
	MOVWF      R4+0
	CALL       _Div_8x8_U+0
	MOVF       R8+0, 0
	MOVWF      R0+0
	MOVLW      48
	ADDWF      R0+0, 0
	MOVWF      FARG_Lcd_Chr_out_char+0
	CALL       _Lcd_Chr+0
;DS1307.c,92 :: 		Lcd_Chr(2,12, (p->sec / 10) + 48);
	MOVLW      2
	MOVWF      FARG_Lcd_Chr_row+0
	MOVLW      12
	MOVWF      FARG_Lcd_Chr_column+0
	MOVF       FARG_DS1307_LCD_Display_Time_p+0, 0
	MOVWF      FSR
	MOVF       INDF+0, 0
	MOVWF      R0+0
	MOVLW      10
	MOVWF      R4+0
	CALL       _Div_8x8_U+0
	MOVLW      48
	ADDWF      R0+0, 0
	MOVWF      FARG_Lcd_Chr_out_char+0
	CALL       _Lcd_Chr+0
;DS1307.c,93 :: 		Lcd_Chr(2,13, (p->sec % 10) + 48);
	MOVLW      2
	MOVWF      FARG_Lcd_Chr_row+0
	MOVLW      13
	MOVWF      FARG_Lcd_Chr_column+0
	MOVF       FARG_DS1307_LCD_Display_Time_p+0, 0
	MOVWF      FSR
	MOVF       INDF+0, 0
	MOVWF      R0+0
	MOVLW      10
	MOVWF      R4+0
	CALL       _Div_8x8_U+0
	MOVF       R8+0, 0
	MOVWF      R0+0
	MOVLW      48
	ADDWF      R0+0, 0
	MOVWF      FARG_Lcd_Chr_out_char+0
	CALL       _Lcd_Chr+0
;DS1307.c,96 :: 		}
L_end_DS1307_LCD_Display_Time:
	RETURN
; end of _DS1307_LCD_Display_Time
